import { View } from "../../../../mvc/core/View";
import { ObjCreate } from "../../common/ObjCreate";
import { GImageBitmap } from "../../../../../com/mui/controls/GImageBitmap";
import { ImagesConst } from "../../../resource/ImagesConst";
import { SWFPlayer } from "../../../scene/modle/SWFPlayer";
import { ModelType } from "../../../scene/modle/data/ModelType";
import { GTextFormat } from "../../../../common/GTextFormat";
import { FontUtil } from "../../../../common/font/FontUtil";
import { HTMLUtil } from "../../../../../com/gengine/utils/HTMLUtil";
import { Language } from "../../../../../extend/language/Language";
import { ActionType } from "../../../scene/modle/data/ActionType";
import { ScaleBitmap } from "../../../../../com/mui/display/ScaleBitmap";
import { GLoadedButton } from "../../../../../com/mui/controls/GLoadedButton";
import { GTextFiled } from "../../../../../com/mui/controls/GTextFiled";
//class PlayerFightStrength
    
    export  class PlayerFightStrength extends View
    {
        constructor()
        {
            super();
            this.init();
            return;
        }

        /* internal  */init(): void
        {
            this._bg = ObjCreate.createBg(0, 0, 135, 55, this);
            this._fightLabel = new GImageBitmap(ImagesConst.FightingStrgLabel, 30, 5);
            addChild(this._fightLabel);
            this._fLabletipTxt = ObjCreate.createGTextField("", 30, 5, 73, 22, this);
            this._fLabletipTxt.toolTipData = this.getTipData();
            this._selectBg = ObjCreate.createBg(10, 28, 122, 24, this, ImagesConst.SelectedBg);
            this._fireEffect = new SWFPlayer();
            this._fireEffect.loadComplete = this.loadEffectComplete;
            this._fireEffect.load("FireEffectFight.swf", ModelType.NormalSwf, null);
            this._fightBtn = ObjCreate.createGLoadedButton("FightingIcon", 20, 30, 19, 18, this);
            this._fightBtn.toolTipData = this.getTipData();
            this._fightStrengthTxt = ObjCreate.createTextField("", 35, 30, 60, 20, this, new GTextFormat(FontUtil.songtiName, 14, 15788607));
            this._fightStrengthTxt.autoSize = flash.text.TextFieldAutoSize.CENTER;
            this._fValuetipTxt = ObjCreate.createGTextField("", 45, 30, 80, 20, this);
            this._fValuetipTxt.toolTipData = HTMLUtil.addColor(Language.getString(30027), "#ffffff");
            return;
        }

        /* internal  */loadEffectComplete(arg1: SWFPlayer): void
        {
            this._fireEffect.updateFrame(ActionType.Stand, 1, true);
            this._fireEffect.updateCurrentFrame(0);
            this._fireEffect.play();
            this._fireEffect.move(15 + 205, 60 + 160);
            return;
        }

        public updateFightStrength(arg1: string): void
        {
            this._fightStrengthTxt.text = arg1;
            return;
        }

        public resetPos(arg1: Boolean): void
        {
            if (arg1) 
            {
                this._bg.height = 65;
                this._fightLabel.y = 8;
                this._fLabletipTxt.y = 8;
                this._selectBg.y = 32;
                this._fightBtn.y = 35;
                this._fightStrengthTxt.y = 35;
                this._fValuetipTxt.y = 35;
            }
            else 
            {
                this._bg.height = 55;
                this._fightLabel.y = 5;
                this._fLabletipTxt.y = 5;
                this._selectBg.y = 28;
                this._fightBtn.y = 30;
                this._fightStrengthTxt.y = 30;
                this._fValuetipTxt.y = 30;
            }
            return;
        }

        /* internal  */getTipData(): string
        {
            var loc1="";
            loc1 = loc1 + HTMLUtil.addColor(Language.getString(30028) + "\n", "#FF7902");
            loc1 = loc1 + HTMLUtil.addColor(Language.getStringByParam(30029, "<font color=\'#f0ea3f\'>", "</font>", "<font color=\'#00ff00\'>") + "</font>。\n", "#ffffff");
            loc1 = loc1 + HTMLUtil.addColor(Language.getStringByParam(30030, "<font color=\'#f0ea3f\'>", "</font>", "<font color=\'#00ff00\'>") + "</font>。\n", "#ffffff");
            loc1 = loc1 + HTMLUtil.addColor(Language.getStringByParam(30031, "<font color=\'#f0ea3f\'>", "</font>", "<font color=\'#00ff00\'>") + "</font>。\n", "#ffffff");
            loc1 = loc1 + HTMLUtil.addColor(Language.getStringByParam(30032, "<font color=\'#f0ea3f\'>", "</font>", "<font color=\'#00ff00\'>") + "</font>。\n", "#ffffff");
            loc1 = loc1 + HTMLUtil.addColor(Language.getStringByParam(30033, "<font color=\'#FF00FF\'>") + "</font>。\n", "#ffffff");
            return loc1;
        }

        /* internal */ /* var */_bg: ScaleBitmap;

        /* internal */ /* var */_fightLabel: GImageBitmap;

        /* internal */ /* var */_selectBg: ScaleBitmap;

        /* internal */ /* var */_fightStrengthTxt: Object /* flash.text.TextField */;

        /* internal */ /* var */_fightBtn: GLoadedButton;

        /* internal */ /* var */_fLabletipTxt: GTextFiled;

        /* internal */ /* var */_fValuetipTxt: GTextFiled;

        /* internal */ /* var */_fireEffect: SWFPlayer;
    }
